package edu.gxmzu.task.controller;

import edu.gxmzu.task.models.*;
import edu.gxmzu.task.service.ReportManagementService;
import edu.gxmzu.task.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Nullable;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@Slf4j
@Tag(name = "管理员模块", description = "报表管理")
public class ReportController {
    @Resource
    private ReportManagementService reportManagementService;

    @Operation(summary = "报表管理查询")
    @GetMapping("/getReport")
    public Result<List<ReportManagementModel>> getReport(
            @Nullable @Parameter(description = "任务名称") String title,
            @Nullable @Parameter(description = "开始时间戳")Long createTime,
            @Nullable @Parameter(description = "结束时间戳") Long endTime
            ){

        List<ReportManagementModel> workStatusList = reportManagementService.getReport(createTime, endTime, title);
        return Result.ok("查询成功", workStatusList);
    }
}
